﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Microsoft.Reporting.WinForms;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            reportViewer1.ProcessingMode = Microsoft.Reporting.WinForms.ProcessingMode.Local;//报表类型
            reportViewer1.LocalReport.ReportPath = "Report2.rdlc";
           
            DataTable dt = new DataTable();
            dt.Columns.Add("Remark");
            dt.Columns.Add("LevelOne");
            dt.Columns.Add("LevelTwo");
            dt.Columns.Add("LevelThree");
            dt.Columns.Add("Unit");
            dt.Columns.Add("Count",DbType.Double.GetType());

            dt.Rows.Add("张三","建筑物", "一二层已建面积", "商业砖混", "M2", 0.3);
            dt.Rows.Add("张三","建筑物", "一二层已建面积", "成套住宅", "M2",0.3);
            dt.Rows.Add("张三","建筑物", "一二层已建面积", "砖混", "M2", 0.3);
            dt.Rows.Add("张三","建筑物", "二层未建面积", "二层未建面积", "M2", 2);
            dt.Rows.Add("张三","建筑物", "三层已建面积", "三层有证", "M2", 6);
            dt.Rows.Add("张三","建筑物", "三层已建面积", "三层认证", "M2", 8);
            dt.Rows.Add("李斯","建筑物", "三层未建面积", "三层未建面积", "M2",2);
            dt.Rows.Add("李斯", "建筑物", "砖木有证", "砖木有证", "M2", 8);
            dt.Rows.Add("李斯", "建筑物", "砖木认证", "砖木认证", "M2", 0);

            dt.Rows.Add("张三","扣除", "建筑物差额款", "建筑物差额款", "M2", 8);
            dt.Rows.Add("李斯", "扣除", "认证相关费用", "认证相关费用", "M2", 3);

            dt.Rows.Add("张三","附属物", "一二层已建面积", "商业砖混", "M2", 1);
            dt.Rows.Add("张三","附属物", "一二层已建面积", "成套住宅", "M2", 2);
            dt.Rows.Add("张三","附属物", "一二层已建面积", "砖混", "M2", 3);
            dt.Rows.Add("张三","附属物", "二层未建面积", "二层未建面积", "M2", 4);
            dt.Rows.Add("李斯", "附属物", "三层已建面积", "三层有证", "M2", 5);
            dt.Rows.Add("李斯", "附属物", "三层已建面积", "三层认证", "M2", 6);
            dt.Rows.Add("李斯", "附属物", "三层未建面积", "三层未建面积", "M2", 7);
            dt.Rows.Add("李斯", "附属物", "砖木有证", "砖木有证", "M2", 7);
            dt.Rows.Add("李斯", "附属物", "砖木认证", "砖木认证", "M2", 1);
            this.reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("DataSet1", dt));
            //var reportParames = new List<ReportParameter>() { 
            //    new ReportParameter("ProjectName"　,""),
            //    new ReportParameter("FamilyCode"　,""),
            //    new ReportParameter("FamilyAddress"　,""),
            //    new ReportParameter("FamilyType"　,""),
            //    new ReportParameter("HeadName"　,""),
            //    new ReportParameter("CardNo"　,""),
            //    new ReportParameter("FamilyPropertyNO"　,""),
            //};
            //reportViewer1.LocalReport.SetParameters(reportParames);//设置报表参数
            this.reportViewer1.RefreshReport();
            //this.reportViewer1.RefreshReport();
        }
    }
}
